a = [
		"\0",
		"XIM_CONNECT\0",
		"XIM_CONNECT_REPLY\0",
		"XIM_DISCONNECT\0",
		"XIM_DISCONNECT_REPLY\0",
		"\0",
		"\0",
		"\0",
		"\0",
		"\0",
		"XIM_AUTH_REQUIRED\0",
		"XIM_AUTH_REPLY\0",
		"XIM_AUTH_NEXT\0",
		"XIM_AUTH_SETUP\0",
		"XIM_AUTH_NG\0",
		"\0",
		"\0",
		"\0",
		"\0",
		"\0",
		"XIM_ERROR\0",
		"\0",
		"\0",
		"\0",
		"\0",
		"\0",
		"\0",
		"\0",
		"\0",
		"\0",
		"XIM_OPEN\0",
		"XIM_OPEN_REPLY\0",
		"XIM_CLOSE\0",
		"XIM_CLOSE_REPLY\0",
		"XIM_REGISTER_TRIGGERKEYS\0",
		"XIM_TRIGGER_NOTIFY\0",
		"XIM_TRIGGER_NOTIFY_REPLY\0",
		"XIM_SET_EVENT_MASK\0",
		"XIM_ENCODING_NEGOTIATION\0",
		"XIM_ENCODING_NEGOTIATION_REPLY\0",
		"XIM_QUERY_EXTENSION\0",
		"XIM_QUERY_EXTENSION_REPLY\0",
		"XIM_SET_IM_VALUES\0",
		"XIM_SET_IM_VALUES_REPLY\0",
		"XIM_GET_IM_VALUES\0",
		"XIM_GET_IM_VALUES_REPLY\0",
		"\0",
		"\0",
		"\0",
		"\0",
		"XIM_CREATE_IC\0",
		"XIM_CREATE_IC_REPLY\0",
		"XIM_DESTROY_IC\0",
		"XIM_DESTROY_IC_REPLY\0",
		"XIM_SET_IC_VALUES\0",
		"XIM_SET_IC_VALUES_REPLY\0",
		"XIM_GET_IC_VALUES\0",
		"XIM_GET_IC_VALUES_REPLY\0",
		"XIM_SET_IC_FOCUS\0",
		"XIM_UNSET_IC_FOCUS\0",
		"XIM_FORWARD_EVENT\0",
		"XIM_SYNC\0",
		"XIM_SYNC_REPLY\0",
		"XIM_COMMIT\0",
		"XIM_RESET_IC\0",
		"XIM_RESET_IC_REPLY\0",
		"\0",
		"\0",
		"\0",
		"\0",
		"XIM_GEOMETRY\0",
		"XIM_STR_CONVERSION\0",
		"XIM_STR_CONVERSION_REPLY\0",
		"XIM_PREEDIT_START\0",
		"XIM_PREEDIT_START_REPLY\0",
		"XIM_PREEDIT_DRAW\0",
		"XIM_PREEDIT_CARET\0",
		"XIM_PREEDIT_CARET_REPLY\0",
		"XIM_PREEDIT_DONE\0",
		"XIM_STATUS_START\0",
		"XIM_STATUS_DRAW\0",
		"XIM_STATUS_DONE\0",
		"XIM_PREEDITSTATE\0",
    ]
b = []
b << 0
c = 0
a.each do |s|
  c += s.length
  b << c
  p c
end
str = a.join
0.upto(b.length-1) do |i|
  if b[i+1].nil? then
    p str[b[i]]
    print "failed\n" if str[b[i]] != a[i]
  else
    p str[b[i]..b[i+1]-1]
    print "failed\n" if str[b[i]..b[i+1]-1] != a[i]
  end
end
print "static gsize opindexes[] = {\n\t"
0.upto(b.length-1) do |i|
  printf("%d, ", b[i]);
  printf("\n\t") if (i+1) % 10 == 0
end
print "\n};\n"
